clc;
clear all;

x = -1:0.01:1;
y = -1:0.01:1;
deviation = 0.2;

EmotionPos(1,1) = -0.41;
EmotionPos(1,2) = 0.79;
EmotionPos(2,1) = -0.11;
EmotionPos(2,2) = 0.79;
EmotionPos(3,1) = -0.6;
EmotionPos(3,2) = 0.4;
EmotionPos(4,1) = 0.41;
EmotionPos(4,2) = 0.89;
EmotionPos(5,1) = 0.7;
EmotionPos(5,2) = 0.72;
EmotionPos(6,1) = 0.9;
EmotionPos(6,2) = 0.16;
EmotionPos(7,1) = 0.83;
EmotionPos(7,2) = -0.5;
EmotionPos(8,1) = 0.22;
EmotionPos(8,2) = -0.67;
EmotionPos(9,1) = 0.02;
EmotionPos(9,2)= -0.98;
EmotionPos(10,1) = -0.32;
EmotionPos(10,2) = -0.79;
EmotionPos(11,1) = -0.82;
EmotionPos(11,2) = -0.4;
EmotionPos(12,1) = -0.92;
EmotionPos(12,2) = -0.13;

EmotionPos(13,1) = 0;
EmotionPos(13,2) = 0;
for i = 1:12
	EmotionPos(13,1) = EmotionPos(13,1) + EmotionPos(i,1);
    EmotionPos(13,2) = EmotionPos(13,2) + EmotionPos(i,2);
end
EmotionPos(13,1) = EmotionPos(13,1) / 12;
EmotionPos(13,2) = EmotionPos(13,2) / 12;

for i = 1:201
    for j = 1:201
        for k = 1:13
            EmotionProbs(k) = exp( -( (x(i)-EmotionPos(k,1))^2 + (y(j)-EmotionPos(k,2))^2  ) / (2*deviation*deviation) );
        end
        z(j,i) = max(EmotionProbs);
%         k = 3;
%         z(j,i) = exp( -( (x(i)-EmotionPos(k,1))^2 + (y(j)-EmotionPos(k,2))^2  ) / (2*deviation*deviation) );
    end
end
figure(1)
surf(x,y,z,'LineStyle','none');
title('Probability of Emotions');
xlabel('Valence');
ylabel('Arousal');
zlabel('Probability');


